package net.doglog;

import java.text.DateFormat;
import java.util.Locale;
import java.util.TimeZone;

/**
 * This class encapsulates all the configurations about the blog. 
 * These configurations were formerly created with a default value 
 * and can be reconfigured via the browser. However, at that time 
 * it was supposed that the view templates should be configurable 
 * on the fly without deploying a new version. But at present the 
 * templates are supposed to be consistent, so they are directly 
 * coded in the JSP files. We can gain some performance advantages 
 * this way as well as a restriction that helps us calm down about 
 * our web page design. I don't think this is something backward. 
 * 
 * From a programmer's perspective, this class should be used as 
 * a singleton. Leaving all the fields public can reduce much more 
 * confusions than writing many stub getters. We don't have any 
 * of these fields stored in the database, either we can't. Just 
 * use it as a concrete collection of several discrete constants. 
 * 
 * @author oipn4e2
 *
 */
public final class Blog {
	public static final String
			errorNoFileFound	=	"找不到文件。",
			errorNoPostFound	=	"找不到文章。",
			errorNoCommentFound	=	"找不到评论。",
			errorCommentSpeakerEmpty	=	"评论者名字不能为空。",
			errorCommentSpeakerNotAllowed	=	"您的名字与管理员名字冲突，请重新选择。",
			errorCommentContentEmpty	=	"评论内容不能为空。",
			errorPostTitleEmpty	=	"文章标题不能为空。",
			errorPostContentEmpty	=	"文章内容不能为空。",
			
			hintPrevPage = "上一页",
			hintNextPage = "下一页",
			
			heading	=	"DOGLOG",
			subhead	=	"Just a Java dog.",
			author	=	"oipn4e2";
	
	/**
	 * This constant refers to the blog's homepage URL.
	 * It's mainly used in serving RSS feeds.
	 * @see net.doglog.FeedServlet#doGet
	 */
	public static final String link = "http://www.doglog.net";
	
	/**
	 * This constant controls how many posts in a page.
	 * BlogServlet and TagServlet show posts in pages.
	 */
	public static final int postPerPage = 7;
	
	public static final int postPerFeed = 7;
	
	public static final int excerptLength = 300;
	
	public static final TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
	
	public static final DateFormat df =
		DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, Locale.CHINA);
	static { df.setTimeZone(tz); }
}
